package com.gem.day08.interfaces3;

/**简单工厂类*/
public class VehicleFactory {
	public static final int BIKE = 1;
	public static final int CAR = 2;
	public static final int PLANE = 3;

	public static Vehicle getVehicle(int type) {
		Vehicle vehicle = null;
		if (type == BIKE) {
			vehicle = new Bike();
		} else if (type == CAR) {
			vehicle = new Car();
		} else if (type == PLANE) {
			vehicle = new Plane();
		} else {
			throw new RuntimeException("参数不合法!");
		}
		return vehicle;
	}
}
